//! Nacos客户端库
//! 
//! 提供Nacos服务发现、配置管理和健康检查功能

pub mod cache;
pub mod client;
pub mod config;
pub mod config_client;
pub mod error;
pub mod naming;
pub mod network;
pub mod retry;

pub use cache::*;
pub use client::*;
pub use config::*;
pub use config_client::*;
pub use error::*;
pub use naming::*;
pub use network::*;
pub use retry::*;
pub use client::NacosClientApi;

// 重新导出核心类型
pub use nacos_core::{ServiceInstance, ConfigItem, Result, NacosError};

/// 客户端版本信息
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

/// 客户端信息
pub struct ClientInfo {
    pub version: &'static str,
    pub name: &'static str,
}

impl ClientInfo {
    pub fn new() -> Self {
        Self {
            version: VERSION,
            name: "nacos-client",
        }
    }
}

impl Default for ClientInfo {
    fn default() -> Self {
        Self::new()
    }
}

/// 预导入模块
pub mod prelude {
    pub use crate::{
        NacosClient,
        ClientConfig,
        ServiceInstance,
        ConfigItem,
        ClientError,
        ClientResult,
    };
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_version() {
        assert!(!VERSION.is_empty());
    }

    #[test]
    fn test_client_info() {
        let info = ClientInfo::new();
        assert_eq!(info.name, "nacos-client");
        assert!(!info.version.is_empty());
    }

    #[test]
    fn test_prelude_imports() {
        // 测试预导入模块是否可用
        assert!(true);
    }
}